<?php

use app\components\BaseGridView;
use app\models\Comment;
use yii\helpers\Html;

?>

<?= \admin\widgets\AdminTabs::widget([
    'items' => Comment::$ownLabels,
    'id' => 'own',
    'all' => FALSE,
    'defaultValue' => Comment::OWN_ACTIVITY
]); ?>

<?= BaseGridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        //['class' => 'yii\grid\SerialColumn'],
        //['class' => 'yii\grid\CheckboxColumn', 'headerOptions' => ['width' => '5%']],
        'id',
        ['label' => '评论者', 'format' => 'raw', 'value' => function (Comment $model) {
            return Html::a($model->user->uname, ['member/view', 'id' => $model->uid], ['class' => 'dialog']);
        }],
        'content',
        ['attribute' => 'status', 'format' => 'raw', 'value' => function (Comment $model) {
            return $model->_statusLabel();
        }],
        'ctime:datetime',
        [
            'class' => 'app\components\BaseActionColumn',
            'template' => '{action}',
            'viewOptions' => ['class' => 'view', 'data-toggle' => 'tooltip', 'title' => '查看反馈'],
            'buttons' => [
                'action' => function ($url, Comment $model, $key) {
                    if ($model->getIsDeny()) {
                        return Html::a('显示评论', $url, ['class' => 'btn get']);
                    }
                    return Html::a('屏蔽', $url, ['class' => 'btn danger get']);
                },
            ]
        ],
    ],
]); ?>
